Marie-Hélène Burle
First, we need to answer the question:
Whenever we work on an important document, we know that we should keep key versions
Example:
Home-made versioning looks something like this:
It is quite messy…
from PhD
And inevitably, it leads to this:
from Geek&Poke
Several systems have been developed over the years with various functioning
Then came Git…
Git is an open source distributed vcs created in 2005 by Linus Torvalds for the versioning of the Linux kernel during its development
In distributed vcs, the full history of projects lives on everybody’s machine—as opposed to being only stored on a central server as was the case with centralized vcs. This allows for offline work and multiple backups
Git also introduced an extremely powerful and light-weight branching system
As a result, Git has dominated the competition since 2011
Nowadays, it is indeed extremely rare to come across any other version control system
Git saves the history of a project as a series of snapshots:
The data is stored as blobs, doesn’t create unnecessary copies (unchanged files are referenced from old blobs), and uses excellent compression
These snapshots are identified by commits:
Each commit has a unique hash and contains the following metadata:
When you create the 1st commit, a pointer called a branch is created and points to it:
By default, that first branch is called main
Another pointer (HEAD) points to the branch main
HEAD indicates where we are in the project history
As you create more commits the pointers HEAD and main move automatically:
As you create more commits the pointers HEAD and main move automatically:
For simplicity, the diagrams can be simplified this way:
You can revisit old commits by moving HEAD to them:
This will uncompress the corresponding snapshot and you can look at the state of your files at that commit before going back to your branch
You can also print the differences between various commits
You can create multiple branches to explore alternative developments:
HEAD can be moved between branches to explore and create new commits
You can merge branches:
This is a very brief intro: Git is very powerful